export function filters(dataIndex: string, data: any[]): any {
  return data.children().map((item: any) => item[dataIndex]).distinct().map((item: any) => ({ text: item, value: item }))
}

export function filter(dataIndex: string): Function {
  return (value: string, record: any): boolean => record[dataIndex]?.indexOf(value) === 0
}

export function sorter(dataIndex: string): Function {
  return (a: any, b: any): number => a[dataIndex]?.localeCompare(b[dataIndex])
}
